package spring.velocity.mvc.lidian;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ListCourse {
	// public class ListCourse implements Controller {
	private CourseService courseService;

	public ModelAndView handleRequest(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
		List<Course> courses = courseService.getAllCourses();
		return new ModelAndView("courseList", "courses", courses);
	}

	public void setCourseService(CourseService courseService) {
		this.courseService = courseService;
	}

}
